﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;

public class OpenH5 : MonoBehaviour {
    public Button btn;

	// Use this for initialization
	void Start () {
        btn.onClick.AddListener(ClickCallback);
	}
    [Serializable]
    public class RoleInfo
    {
        public string roleId;
        public string roleName;
        public string serverId;
        public string serverName;
        public string userId;
        public string roleLevel;
    }
    //string strRoleInfo = "{roleId:'140040603', roleName: '2048', serverId: '210015', serverName: '官网混服', userId: '01000100000000000000000000000000222546288', roleLevel: '665'}";
    //byte[] bytes =   roleInfo;// Convert.FromBase64String(strRoleInfo);
    void ClickCallback()
    {
        string strURL = "https://zhzr.uwan.com/t2/227/5609.html?cdid=";
        RoleInfo roleInfo = new RoleInfo();
        roleInfo.roleId = "140040603";
        roleInfo.roleName = "2048";
        roleInfo.serverId = "210015";
        roleInfo.serverName = "官网混服S15";
        roleInfo.userId = "01000100000000000000000000000000222546288";
        roleInfo.roleLevel = "665";
        string json = JsonUtility.ToJson(roleInfo);
        byte[] bytes = Encoding.UTF8.GetBytes(json);
        Application.OpenURL(strURL + Convert.ToBase64String(bytes));
        Debug.Log("click");
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}
